package com.nit.generate;

import com.nit.tools.loop.NitLoopTools;

import java.util.Random;

/**
 * 微信号 生成器
 *
 * @Auth: 逆天开源-逍遥哥哥
 * @link: 1715656022@qq.com
 * @Date: 2023-07-25
 */
public class NitWeChatIDGenerator {
    public static final String CHARACTER = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; // 可选的字符集合
    
    public static void main(String[] args) {
        NitLoopTools.loop(4, () -> {
            String tmp = NitWeChatIDGenerator.generate();
            System.out.println("随机微信号:" + tmp + "<br>");
        });
    }

    public static String generate() {
        return generateWeChatID(NitNumberGenerator.generateInt(6, 24));
    }

    public static String generateWeChatID(int length) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        NitLoopTools.loop(length, () -> {
            sb.append(CHARACTER.charAt(random.nextInt(CHARACTER.length())));
        });

        return sb.toString();
    }
}
